from apps.common.base.dao import BaseDao
from apps.system.rank.serializers import *

class RankDao(BaseDao):
    MODEL_CLASS = Rank
    SERI_CLASS = RankBaseSerializer

    def findOneByLesseeIdAndGrade(self, lesseeId, grade):
        print(lesseeId, grade)
        _ranks = self.findAllByLesseeId(lesseeId).filter(grade=grade)
        if _ranks.exists():
            return _ranks.first()
        else:
            print('级别不存在')
            return None